//
//  WXPHomePageVC.m
//  MexicoLoan
//
//  Created by wxp on 2025/2/25.
//

#import "WXPHomePageVC.h"
#import "WXPNotAuthHomeVC.h"
#import "WXPAlreadyAuthHomeVC.h"
#import "NotificationView.h"
#import "WXPFicoPopView.h"
#import "WXPCreditReportDetailVC.h"
#import "WXPIncreaseQuotaPopView.h"
#import "UpdatePopUpWindowView.h"

@interface WXPHomePageVC ()

@property (nonatomic, strong) UIImageView * imageTopBg;

@property (nonatomic, strong) WXPNotAuthHomeVC * notAuthVC;
@property (nonatomic, strong) WXPAlreadyAuthHomeVC * alreadyAuthVC;
@property (nonatomic, strong) NotificationView * notificationView;

@property (nonatomic, strong) WXPCommonAgreementView * agreementView;
@property (nonatomic, strong) NSDictionary * deviceInfo;

@property (nonatomic, strong) NSDictionary * homePopResponse;
@property (nonatomic, assign) BOOL isShowReport;
@property (nonatomic, assign) BOOL isHideCloundun;
@property (nonatomic, assign) BOOL isHideFICO;
@property (nonatomic, strong) WXPTwoBtnPopUpWindowView *auditFailView;
@property (nonatomic, strong) WXPTwoBtnPopUpWindowView *checkFailView;
@property (nonatomic, strong) WXPFicoPopView * ficoPopView;
@property (nonatomic, strong) WXPIncreaseQuotaPopView * increaseQuotaPopView;
@property (nonatomic, strong) UpdatePopUpWindowView * updatePromptView;
@property (nonatomic, strong) UIView * viewLoadingShade;

@end

@implementation WXPHomePageVC

#pragma mark - lazy
- (UIImageView *)imageTopBg{
    if (!_imageTopBg) {
        _imageTopBg = [UIImageView new];
        _imageTopBg.image = [UIImage imageNamed:@"icon-top-bg"];
        _imageTopBg.widthHeight = XY(SCREEN_WIDTH, SCREEN_WIDTH/1125*918);
        _imageTopBg.leftTop = XY(0, 0);
    }
    return _imageTopBg;
}
- (WXPNotAuthHomeVC *)notAuthVC{
    if (!_notAuthVC) {
        _notAuthVC = [WXPNotAuthHomeVC new];
        WEAKSELF
        _notAuthVC.blockGetNotificationView = ^{
            [weakSelf requestAppNotice];
        };
    }
    return _notAuthVC;
}
- (WXPAlreadyAuthHomeVC *)alreadyAuthVC{
    if (!_alreadyAuthVC) {
        _alreadyAuthVC = [WXPAlreadyAuthHomeVC new];
        _alreadyAuthVC.view.hidden = true;
        WEAKSELF
        _alreadyAuthVC.blockGetNotificationView = ^{
            [weakSelf requestAppNotice];
        };
    }
    return _alreadyAuthVC;
}
- (NotificationView *)notificationView{
    if (!_notificationView) {
        _notificationView = [NotificationView new];
    }
    return _notificationView;
}
- (WXPCommonAgreementView *) agreementView
{
    if (_agreementView == nil) {
        _agreementView = [WXPCommonAgreementView  new];
    }
    return  _agreementView;
}
// 审核未通过
- (WXPTwoBtnPopUpWindowView *)auditFailView{
    if (!_auditFailView) {
        _auditFailView = [WXPTwoBtnPopUpWindowView new];
        WEAKSELF
        _auditFailView.blockRightClick = ^{
            [weakSelf removePopView];
            // 审核未通过
            if(weakSelf.isShowReport && [weakSelf.homePopResponse boolValueForKey:KEY_hadLoan]){
                WXPCreditReportDetailVC * vc = [WXPCreditReportDetailVC new];
                vc.type = ENUM_REPORT_FICO;
                [Global_Nav pushViewController:vc animated:true];
            }
        };
    }
    return _auditFailView;
}
// 预检未通过
- (WXPTwoBtnPopUpWindowView *)checkFailView{
    if (!_checkFailView) {
        _checkFailView = [WXPTwoBtnPopUpWindowView new];
        WEAKSELF
        _checkFailView.blockRightClick = ^{
            [weakSelf removePopView];
            // 预检未通过
            if(weakSelf.isShowReport && [weakSelf.homePopResponse boolValueForKey:KEY_hadLoan]==false){
                WXPCreditReportDetailVC * vc = [WXPCreditReportDetailVC new];
                vc.type = ENUM_REPORT_CLOUNDUN;
                [Global_Nav pushViewController:vc animated:true];
            }
        };
    }
    return _checkFailView;
}
// FICO弹窗
- (WXPFicoPopView *)ficoPopView
{
    if (_ficoPopView == nil) {
        _ficoPopView = [WXPFicoPopView  new];
        WEAKSELF
        _ficoPopView.blockConfirmClick = ^{
            [weakSelf removePopView];
            if(weakSelf.isShowReport && [weakSelf.homePopResponse boolValueForKey:KEY_hadLoan]==true){
                WXPCreditReportDetailVC * vc = [WXPCreditReportDetailVC new];
                vc.type = ENUM_REPORT_FICO;
                [Global_Nav pushViewController:vc animated:true];
            }
        };
    }
    return  _ficoPopView;
}
// 提额弹窗
- (WXPIncreaseQuotaPopView *)increaseQuotaPopView
{
    if (_increaseQuotaPopView == nil) {
        _increaseQuotaPopView = [WXPIncreaseQuotaPopView  new];
        WEAKSELF
        _increaseQuotaPopView.blockOKClick = ^{
            [weakSelf.alreadyAuthVC requestIsJumpToCPI];
            weakSelf.alreadyAuthVC.blockRequestIsJumpToCPIFinish = ^{
                [weakSelf.increaseQuotaPopView removeFromSuperview];
            };
        };
    }
    return  _increaseQuotaPopView;
}
- (UpdatePopUpWindowView *)updatePromptView
{
    if (_updatePromptView == nil) {
        _updatePromptView = [UpdatePopUpWindowView  new];
    }
    return  _updatePromptView;
}
- (UIView *)viewLoadingShade{
    if (!_viewLoadingShade) {
        _viewLoadingShade = [UIView new];
        _viewLoadingShade.backgroundColor = [UIColor colorWithHexString:@"ffffff" alpha:0.6];
        _viewLoadingShade.widthHeight = XY(SCREEN_WIDTH, SCREEN_HEIGHT);
        _viewLoadingShade.leftTop = XY(0, 0);
    }
    return _viewLoadingShade;
}

#pragma mark - viewDidLoad
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    [self.view addSubview:self.viewLoadingShade];
    UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
    NSArray *subviews = window.subviews;
    for (UIView *subview in subviews) {
        if (subview.tag >= 10000) {
            subview.hidden = false;
        }
    }
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
    NSArray *subviews = window.subviews;
    for (UIView *subview in subviews) {
        if (subview.tag >= 10000) {
            subview.hidden = true;
        }
    }
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    // requets
    [self requestGetNextStepNew];
    [self requestIncreaseCreditPopInfo];
    [self checkUploadDeviceInfo];
    //登录成功-请求用户个人信息
    [self requestUserInfo];
    // 打点
    [GlobalMethod hitPointWithPageName:KEY_Home action:KEY_Enter extInfo:nil];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabbarChangeToOrdeList:) name:TABBAR_CHANGE_TO_ORDER object:nil];
    
    self.viewBG.backgroundColor = COLOR_BACKGROUND;
    [self.view addSubview:self.imageTopBg];
//    [self.view addSubview:self.navView];
//    [self.navView addSubview:self.btnNotification];
//    [self showBlurView];
    
    [self configUI];
    [self requestAppUpdateConfig];
    [self requestAppNotice];
}

- (void)tabbarChangeToOrdeList:(NSNotification *)notification {
    [self.tabBarController setSelectedIndex:1];
}

#pragma mark - UI
- (void)configUI{
    CGFloat bottom = 50+([GlobalMethod getBottomSafeAreaHeight] == 0 ? LEFT_MARDIN : [GlobalMethod getBottomSafeAreaHeight]);
    self.agreementView.centerXBottom = XY(SCREEN_WIDTH/2, SCREEN_HEIGHT-bottom);
    [self.view addSubview:self.agreementView];
    
    [self addChildViewController:self.notAuthVC];
    [self addChildViewController:self.alreadyAuthVC];
    
    // 未认证首页
    self.notAuthVC.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, self.agreementView.top);
    self.notAuthVC.tableView.frame = self.notAuthVC.view.bounds;
    [self.view addSubview:self.notAuthVC.view];
    
    // 已认证首页
    self.alreadyAuthVC.view.frame = self.notAuthVC.view.frame;
    self.alreadyAuthVC.tableView.frame = self.alreadyAuthVC.view.bounds;
    [self.view addSubview:self.alreadyAuthVC.view];
    
    [self.view addSubview:^{
        UIView *view = [UIView new];
        view.widthHeight = XY(SCREEN_WIDTH, MAX([GlobalMethod getStatusBarHeight]-5, 20));
        view.leftTop = XY(0, 0);
        view.backgroundColor = COLOR_PRIMARY;
        return view;
    }()];
}

#pragma mark -  统一管理弹窗
- (void)showPopViewWithView:(UIView *)popView priority:(NSInteger)priority {
    UIWindow *window = [UIApplication sharedApplication].windows.firstObject;
    NSArray *subviews = window.subviews;
    UIView *targetView = nil;
    for (UIView *subview in subviews) {
        if (subview.tag < priority && subview.tag >= 10000) {
            targetView = subview;
            break;
        }
    }
    popView.tag = priority;
    if (targetView) {
        [window insertSubview:popView belowSubview:targetView];
    } else {
        [window addSubview:popView];
    }
}
- (void)removePopView{
    [self.ficoPopView removeFromSuperview];
    [self.checkFailView removeFromSuperview];
    [self.auditFailView removeFromSuperview];
}

#pragma mark - request
// 请求用户信息
- (void)requestUserInfo{
    [RequestApi requestUserInformationWithDelegate:nil success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}

// 检查是否需要上传扩展信息
- (void)checkUploadDeviceInfo{
    [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Check extInfo:nil];
    [RequestApi requestCheckUploadDeviceInfoWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        BOOL needUploadDeviceInfo = [response boolValueForKey:KEY_deviceInfo];
        if(needUploadDeviceInfo){
            [self uploadDeviceInfo];
        }
        BOOL needUploadAddressBook = [response boolValueForKey:KEY_addressBook];
        if(needUploadAddressBook){
            [self uploadAddressBookInfo];
        }
        BOOL needUploadCalendarInfo = [response boolValueForKey:KEY_calendarInfo];
        if(needUploadCalendarInfo){
            [self uploadCalendarInfo];
        }
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}
// 上传设备信息
- (void)uploadDeviceInfo{
    NSMutableDictionary * authExtInfoDic = [NSMutableDictionary  new];
    if (isStr([GlobalData sharedInstance].Global_UserCode)) {
        [authExtInfoDic setObject:[GlobalData sharedInstance].Global_UserCode forKey:KEY_userId];
    }
    // 获取设备信息
    WEAKSELF
    [GlobalMethod getDeviceInfoBlock:^(NSDictionary *dict) {
        if ([weakSelf.deviceInfo count] && weakSelf.deviceInfo) {
            // 已获取设备信息，为防止接口频繁调用
        }else{
            weakSelf.deviceInfo = dict;
            // 需要上传设备信息
            if(weakSelf.deviceInfo != nil){
                [authExtInfoDic setObject:weakSelf.deviceInfo forKey:KEY_device_info];
                [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_DeviceInfo_Upload extInfo:nil];
                // 执行上传任务
                [RequestApi requestUploadExtInfoWithExtInfo:authExtInfoDic delegate:nil success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
                    [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_DeviceInfo_End extInfo:@{@"isSuccess": @"true", @"errorMsg": @""}];
                } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
                    [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_DeviceInfo_End extInfo:@{@"isSuccess": @"false", @"errorMsg": errorStr}];
                }];
            }
        }
    }];
}

// 上传通讯录
- (void)uploadAddressBookInfo{
    NSMutableDictionary * authExtInfoDic = [NSMutableDictionary  new];
    if (isStr([GlobalData sharedInstance].Global_UserCode)) {
        [authExtInfoDic setObject:[GlobalData sharedInstance].Global_UserCode forKey:KEY_userId];
    }
    // 获取通讯录
    [GlobalMethod getAddressBookAuthorityBlock:^{
        [GlobalMethod asynthicBlock:^{
            [GlobalMethod getAddressBookArrayBlock:^(NSMutableArray *array) {
                if(isAry(array)){
                    [authExtInfoDic setObject:array forKey:KEY_address_book];
                    // 执行上传任务
                    [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Contact_Upload extInfo:nil];
                    [RequestApi requestUploadExtInfoWithExtInfo:authExtInfoDic delegate:nil success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
                        
                    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
                        
                    }];
                }
            }];
        }];
    } isShowTips:false];
}

// 上传日历信息
- (void)uploadCalendarInfo{
    NSMutableDictionary * authExtInfoDic = [NSMutableDictionary  new];
    if (isStr([GlobalData sharedInstance].Global_UserCode)) {
        [authExtInfoDic setObject:[GlobalData sharedInstance].Global_UserCode forKey:KEY_userId];
    }
    // 获取日历信息
    [GlobalMethod getCalendarInfoBlock:^(NSMutableArray *array) {
        [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Calendar_Read extInfo:@{@"count": [NSString stringWithFormat:@"%ld", array.count]}];
        [authExtInfoDic setObject:(isAry(array))?array:@[] forKey:KEY_calendar_list];
        // 执行上传任务
        [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Calendar_Upload extInfo:nil];
        [RequestApi requestUploadExtInfoWithExtInfo:authExtInfoDic delegate:nil success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
            [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Calendar_End extInfo:@{@"isSuccess": @"true", @"errorMsg": @""}];
        } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
            [GlobalMethod hitPointWithPageName:KEY_ExtInfoUpload action:KEY_Calendar_End extInfo:@{@"isSuccess": @"false", @"errorMsg": errorStr}];
        }];
    }];
}


- (void)requestAppUpdateConfig{
    [RequestApi requestAppUpdateConfigWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
        BOOL isShow = [response boolValueForKey:KEY_update];
        if (isShow) {
            ModelBtn * model = [ModelBtn new];
            model.content = [response stringValueForKey:KEY_updateRemark];
            model.title = [response stringValueForKey:KEY_updateUrl];
            model.isSelected = [response boolValueForKey:KEY_urlType];
            [self.updatePromptView resetViewWithModel:model];
            if([GlobalMethod readBoolLocal:LOCAL_HAVE_SHOW_APP_UPDATE] == false){
                // 还未显示过软更弹窗-弹窗显示
                [self showPopViewWithView:self.updatePromptView priority:10000];
                [GlobalMethod writeBool:true local:LOCAL_HAVE_SHOW_APP_UPDATE];
            }
        }
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}
// 获取下一步该填写信息的step
- (void)requestGetNextStepNew{
    [RequestApi requestGetNextStepNewWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
        if (response && [response isKindOfClass:[NSDictionary class]] && response.count > 0) {
            // 有返回数据，
            // 显示 默认样式
            NSString * step = @"";
            for (NSString * key in response) {
                id value = response[key];
                if ([value isKindOfClass:[NSString class]]){
                    if ([value isEqualToString:@"1"]) {
                        step = key;
                        break;
                    }
                }
            }
            [self requestBannerUrlWithPage:0];
            self.notAuthVC.INFO_NAME = step;
            self.notAuthVC.view.hidden = false;
            self.alreadyAuthVC.view.hidden = true;
        }else{
            // 无返回数据 - 认证完成
            [self requestBannerUrlWithPage:1];
            self.notAuthVC.view.hidden = true;
            self.alreadyAuthVC.view.hidden = false;
        }
        // 是否显示信用报告
        [self requestIsShowCREntrance];
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}
// 获取banner图片
- (void)requestBannerUrlWithPage:(NSInteger)page {
    [RequestApi requestAppBannerUrlWithPage:page delegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
        NSMutableArray * bannerAry = [NSMutableArray new];
        [bannerAry removeAllObjects];
        NSArray * aryResponse = [GlobalMethod exchangeDic:response toAryWithModelName:@"ModelBanner"];
        if (isAry(aryResponse)) {
            [bannerAry addObjectsFromArray: aryResponse];
            if(page == 0){
                [self.notAuthVC.bannerView resetViewWithAry:bannerAry];
                [self.notAuthVC resetHeaderView];
            }else{
                [self.alreadyAuthVC.bannerView resetViewWithAry:bannerAry];
                [self.alreadyAuthVC resetHeaderView];
            }
        }
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}
// 是否展示信用报告
- (void)requestIsShowCREntrance{
    [RequestApi requestIsShowCREntranceWithPartnerId:@"2fec752cc5d9a2774911936cfb21dd39" pageType:[NSNumber numberWithInteger:1] delegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        self.isShowReport = false;
        if ([response isKindOfClass:[NSNumber class]]) {
            self.isShowReport = [(NSNumber *)response boolValue];
        }
        if(self.isShowReport){
            // true-显示 信用报告
        }else{
            // false-隐藏 信用报告
            self.isHideFICO = true;
            self.isHideCloundun = true;
            if(self.notAuthVC.view.hidden == true){
                // 已认证
                self.alreadyAuthVC.isHideFICO = self.isHideFICO;
                self.alreadyAuthVC.isHideCloundun = self.isHideCloundun;
                [self.alreadyAuthVC resetHeaderView];
            }else{
                self.notAuthVC.isHideFICO = self.isHideFICO;
                self.notAuthVC.isHideCloundun = self.isHideCloundun;
                [self.notAuthVC resetHeaderView];
            }
        }
        // 显示报告，再调用 首页弹窗信息(不管信用报告是否展示，下面接口homePop都要调用)
        [self requestHomePopupWindow:!self.isShowReport];
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {

    }];
}
// 首页弹窗信息
// isHideReport == true 直接隐藏信用报告区域
- (void)requestHomePopupWindow:(bool)isHideReport{
    [RequestApi requestCommonHomePopWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {

        // hadLoan=true && fICOPayed=false时，展示FICO区域
        self.homePopResponse = response;
        BOOL hadLoan = [response boolValueForKey:KEY_hadLoan];
        BOOL fICOPayed = [response boolValueForKey:KEY_fICOPayed];
        if(hadLoan && fICOPayed == false){
            self.isHideFICO = false;
        }else{
            self.isHideFICO = true;
        }
        // hadLoan=false && cloudunPayed=false时，展示Cloundun区域
        BOOL cloudunPayed = [response boolValueForKey:KEY_cloudunPayed];
        if(hadLoan==false && cloudunPayed == false){
            self.isHideCloundun = false;
        }else{
            self.isHideCloundun = true;
        }
        
        if (isHideReport == true) {
            // 是否展示信用报告接口，返回false，则直接隐藏信用报告区域，不需要执行下面的判断了
        }else{
            if(self.notAuthVC.view.hidden == true){
                // 已认证
                self.alreadyAuthVC.isHideFICO = self.isHideFICO;
                self.alreadyAuthVC.isHideCloundun = self.isHideCloundun;
                [self.alreadyAuthVC resetHeaderView];
            }else{
                self.notAuthVC.isHideFICO = self.isHideFICO;
                self.notAuthVC.isHideCloundun = self.isHideCloundun;
                [self.notAuthVC resetHeaderView];
            }
        }

        // 审核未通过
        BOOL loanFail = [response boolValueForKey:KEY_loanFail];
        if(loanFail){
            ModelBtn * model = [ModelBtn new];
            model.imageName = @"icon-KTP-fail";
            model.content = @"Lamentablemente, su solicitud de préstamo no ha sido aprobada.";
            model.rightName = @"Puntuación de crédito";
            self.auditFailView.labelContent.textColor = COLOR_BLACK;
            self.auditFailView.labelContent.font = [UIFont boldSystemFontOfSize:16];
            [self.auditFailView resetWithModel:model];
            [self.auditFailView resetOnlyShowRightBtn];
            // 一天只执行一次
            [GlobalMethod executeOncePerDayWithKey:LOCAL_HOMEPAGE_AUDIT_FAIL block:^{
                [self showPopViewWithView:self.auditFailView priority:10005];
            }];
        }

        // 预检未通过
        BOOL loanCheck = [response boolValueForKey:KEY_loanCheck];
        if(loanCheck){
            ModelBtn * model = [ModelBtn new];
            model.imageName = @"icon-KTP-fail";
            model.content = @"Lamentablemente, en este momento no tenemos ningún préstamo disponible para usted.";
            model.rightName = @"Puntuación de crédito";
            self.checkFailView.labelContent.textColor = COLOR_BLACK;
            self.checkFailView.labelContent.font = [UIFont boldSystemFontOfSize:16];
            [self.checkFailView resetWithModel:model];
            [self.checkFailView resetOnlyShowRightBtn];
            [self showPopViewWithView:self.checkFailView priority:10004];
        }

        // FICO弹窗
        BOOL ficoPop = [response boolValueForKey:KEY_ficoPop];
        if(ficoPop){
            [self showPopViewWithView:self.ficoPopView priority:10003];
        }
        [self.viewLoadingShade removeFromSuperview];

    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {

    }];
}

// 提额弹窗信息
- (void)requestIncreaseCreditPopInfo{
    [RequestApi requestIncreaseCreditPopWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
//        response = @{
//            @"pop": @(true),
//            @"oldCredit": @"$1,000",
//            @"nowCredit": @"$50,000",
//            @"nextCredit": @"$50,500",
//            @"countDownTime": @(60)
//        };
        
        int isPop = [response[KEY_pop] intValue];
        if(isPop == 1){
            [self.increaseQuotaPopView resetViewWithLeftMoney:[response stringValueForKey:KEY_oldCredit] middleMoney:[response stringValueForKey:KEY_nowCredit] rightMoney:[response stringValueForKey:KEY_nextCredit] time:[response intValueForKey:KEY_countDownTime]];
            [self showPopViewWithView:self.increaseQuotaPopView priority:10002];
        }
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}
// 获取App公告接口
- (void)requestAppNotice{
    [RequestApi requestAppNoticeWithDelegate:self success:^(NSDictionary * _Nonnull response, id  _Nonnull mark) {
        
        BOOL isShow = [response boolValueForKey:KEY_show];
        NSString * content = [response stringValueForKey:KEY_content];
        if (isShow) {
            [self.notificationView resetViewWithContent:content];
            [self showPopViewWithView:self.notificationView priority:10001];
            // nav - 消息按钮
            self.notAuthVC.btnNotification.hidden = false;
            self.alreadyAuthVC.btnNotification.hidden = false;
        }else{
            self.notAuthVC.btnNotification.hidden = true;
            self.alreadyAuthVC.btnNotification.hidden = true;
        }
        
    } failure:^(NSString * _Nonnull errorStr, id  _Nonnull mark) {
        
    }];
}

@end
